home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d21 / dvglue.arc / TVBREAD.C < prev    next >
C/C++ Source or Header  |  1990-01-09  |  1KB  |  37 lines

  1. /*================================================*/
  2. /* TVBREAD.C                                      */
  3. /*                                                */
  4. /* (c) Copyright 1988 Ralf Brown                  */
  5. /*     All Rights Reserved                        */
  6. /* May be freely copied for noncommercial use,    */
  7. /* provided that this copyright notice remains    */
  8. /* intact and any changes are indicated in the    */
  9. /* comment blocks preceding functions             */
  10. /*================================================*/
  11.  
  12. #include "tvapi.h"
  13.  
  14. /*================================================*/
  15. /* TVreadmail  wait for next message              */
  16. /*   Ralf Brown 4/22/88                           */
  17. /*================================================*/
  18.  
  19. int pascal TVreadmail(OBJECT mbx,char *buffer,int maxsize)
  20. {
  21.    PARMLIST2 p ;
  22.    int count ;
  23.  
  24.    p.num_args = 0 ;
  25.    TVsendmsg(READ_MSG, mbx?TOS:MAILME, mbx, (PARMLIST *)&p) ;
  26.    count = (int) p.arg[1] ;
  27.    maxsize-- ;  /* reserve space for null to terminate string */
  28.    if (count > maxsize)
  29.       count = maxsize ;
  30.    while (count-- > 0)
  31.       *buffer++ = *((char far *)p.arg[0])++ ;
  32.    *buffer = '\0' ;
  33.    return (int) p.arg[1] ;
  34. }
  35.  
  36. /* End of TVBREAD.C */
  37.